import com.dmw.dao.IUserDaoRepository01;
import com.dmw.dao.IUserDaoRepository02;
import com.dmw.pojo.UserTrans;
import com.dmw.pojo.Users;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class IUsersDaoRepositoryTest02 {
    @Autowired
    private IUserDaoRepository02 userDao;

    @Test
    @Transactional
    @Rollback(false)
    public void findByUserName() {
        List<Users> usersList = userDao.findUserName("猛虎");
        usersList.forEach(e -> System.out.println(e.toString()));
    }

    @Test
    @Transactional
    @Rollback(false)
    public void findByUserNameLike() {
        List<Users> usersList = userDao.findUserNameLike("%虎");
        usersList.forEach(e -> System.out.println(e.toString()));
    }

    @Test
    @Transactional
    @Rollback(false)
    public void findByUserNameAndRealName() {
        List<Users> usersList = userDao.findUserNameAndRealName("浮萍","邓亚萍");
        usersList.forEach(e -> System.out.println(e.toString()));
    }


}
